package cerebrum.common;

import java.net.InetAddress;

public class NetworkTestingUtil {
    /**
     * 传入需要连接的IP，返回是否连接成功
     *
     * @return
     */
    public static boolean isReachable() {
        String remoteInetAddr = "www.baidu.com";//需要连接的IP地址
        boolean reachable = false;
        try {
            InetAddress address = InetAddress.getByName(remoteInetAddr);
            reachable = address.isReachable(5000);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return reachable;
    }
}

